#include <iostream>
#include <cmath>

/**
 * 稀疏图的判定
 */
int main(){
    int n;
    std::cin >> n;

    int edges = 0;
    for(int i=1;i<=n;i++){
        for(int j = 1;j<=n;j++){
            int x;
            std::cin >> x;
            if (i!=j && x == 1){
                edges++;
            }
        }
    }

    bool sparse = edges <  10* n;

    if (sparse){
        std::cout << "Yes\n";
    }else{
        std::cout << "No\n";
    }


    return 0;
}